using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using System.Windows.Forms;
using System.Data;
using System.Drawing;
using System.Reflection;
using DevExpress.XtraGrid;
using DevExpress.XtraEditors;
using THSLib;

namespace THSERP.BaseProvider
{
    public partial class THSLabel : DevExpress.XtraEditors.LabelControl
    {
        #region Variables
        protected String _THSFieldGroup;
        protected String _THSFieldRelation;
        protected THSERPScreen _screen;
        protected String _THSDataSource;
        protected String _THSDataMember;
        protected String _THSComment;
        protected String _THSPrivilege;
        #endregion

        #region Public Properties
        public THSERPScreen Screen
        {
            get { return _screen; }
            set { _screen = value; }
        }

        [Category("THS")]
        public String THSFieldGroup
        {
            get
            {
                return _THSFieldGroup;
            }
            set
            {
                _THSFieldGroup = value;
            }
        }

        [Category("THS")]
        public String THSFieldRelation
        {
            get { return _THSFieldRelation; }
            set { _THSFieldRelation = value; }
        }

        [Category("THS")]
        public String THSDataSource
        {
            get
            {
                return _THSDataSource;
            }
            set
            {
                _THSDataSource = value;
            }
        }

        [Category("THS")]
        public String THSDataMember
        {
            get
            {
                return _THSDataMember;
            }
            set
            {
                _THSDataMember = value;
            }
        }

        [Category("THS")]
        public String THSComment
        {
            get
            {
                return _THSComment;
            }
            set
            {
                _THSComment = value;
            }
        }

        [Category("THS")]
        public String THSPrivilege
        {
            get
            {
                return _THSPrivilege;
            }
            set
            {
                _THSPrivilege = value;
            }
        }
        #endregion

        #region Constructor
        public THSLabel()
        {
            InitializeComponent();
        }

        public THSLabel(IContainer container)
        {
            container.Add(this);

            InitializeComponent();
        }
        #endregion

        #region--Initialize--
        public void InitializeControl()
        {
            if (!String.IsNullOrEmpty(this.THSDataSource) && !String.IsNullOrEmpty(this.THSDataMember))
            {
                if (this.THSDataSource.Equals("ADConfigValues"))
                {
                    String strText = ADConfigValueUtility.GetTextFromKey(this.THSDataMember);
                    if (!String.IsNullOrEmpty(strText))
                        this.Text = strText;
                }
                else
                {
                    //hieu.nguyen remove 09/02/2012
                    // 
                   // this.Tag = "DC";
                    if (!String.IsNullOrEmpty(this.THSDataSource) && !String.IsNullOrEmpty(this.THSDataMember))
                        Screen.BindingDataControl(this);
                }
            }
        }
        #endregion
    }
}
